package com.gjs.cd.config;

import com.gjs.common.manager.SmsVerifyCode;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SmsValidCodeConfig {

    @Value("${register.cache-key}")
    private String registerCacheKey;

    @Value("${register.expire}")
    private Long registerExpire;

    @Value("${reset-password.cache-key}")
    private String resetPasswordCacheKey;

    @Value("${reset-password.expire}")
    private Long resetPasswordExpire;

    @Bean
    public SmsVerifyCode smsValidCode(){
        SmsVerifyCode smsVerifyCode = new SmsVerifyCode();
        smsVerifyCode.setRegisterCacheKey(registerCacheKey);
        smsVerifyCode.setRegisterExpire(registerExpire);
        smsVerifyCode.setRestPasswordCacheKey(resetPasswordCacheKey);
        smsVerifyCode.setRestPasswordExpire(resetPasswordExpire);
        return smsVerifyCode;
    }
}
